clear; clc;

%%
dev=EquipmentControl.AnalyseEquipment.ZI.ziMFLI('dev3543', 6);
dev.sync();

%%
sweeper = dev.sweepModule();
sweeper.setControl('xmapping', 1, 'start', 1e3)...
       .setFilter('bandwidthcontrol', 0)...
       .setSettling('settling_tc', 1)...
       .setStatistics('averaging_sample', 100)...
       .setOption()...
       .showParam();

%%
sweeper.subscribeChannel('1');
result = sweeper.batchSweep(@batch_fun, 1:2);
sweeper.unsubscribeChannel('1');

%%
function res = batch_fun(swpr, idx, varargin)
%     p=inputParser;
%     p.addParameter('additional_param', 3.0);
%     p.parse(varargin{:});
    
%     % do something here
      pause(1);

    % do the sweep
    res = swpr.run('index', idx, 'silence', 0);
end
